package com.donfu.web.controller.house;

import com.donfu.common.annotation.Log;
import com.donfu.common.core.domain.AjaxResult;
import com.donfu.common.enums.BusinessType;
import com.donfu.common.utils.poi.ExcelUtil;
import com.donfu.system.domain.house.HouseGoodsSku;
import com.donfu.system.service.house.IHouseOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Auther: 覃创斌
 * @Date: 2021/12/11 23:20
 * @Description:
 */
@Api(tags = "后台--商品sku(存具体的商品)")
@RestController
@RequestMapping("/house/index")
public class HouseIndexCountController {

    @Autowired
    private IHouseOrderService houseOrderService;

    /*
    * @作者 覃创斌
    * @描述 首页统计数据
    * @日期 2021/12/11
    **/
    @GetMapping("/indexCount")
    public AjaxResult indexCount()
    {
        Map<String,Integer> userCount = houseOrderService.getUserCount();
        Map<String,Integer> orderCount = houseOrderService.getOrderCount();
        Map<String,Integer> orderPriceCount = houseOrderService.getOrderPriceCount();
        Map<String,Integer> goodsCount = houseOrderService.getGoodsCount();
        List<Map<String,String>> goodsGroupCount = houseOrderService.getGoodsGroupCount();
        List<Map<String,String>> orderPriceSum = houseOrderService.getOrderPriceSum();
        List<Map<String,String>> orderSum = houseOrderService.getOrderSum();

        return AjaxResult.success()
                .put("userCount",userCount)//用户总数
                .put("orderCount",orderCount)//订单总数
                .put("orderPriceCount",orderPriceCount)//交易总金额
                .put("goodsCount",goodsCount)//商品总数
                .put("goodsGroupCount",goodsGroupCount)//所有分类的商品数量
                .put("orderPriceSum",orderPriceSum)//近七天的成交额
                .put("orderSum",orderSum);//近七天的订单数量
    }
}
